<script setup>
import {useRoute} from "vue-router";
const route=useRoute();
let id=route.params.id

const user=ref([null])
const getUser=async () =>{
    const response= await http.get('/user/getUserById',{
        params:{id},
    });
    user.value=response.data;
};

onMounted(()=>{
    getUser();
});
</script>
<template>
    <div>
        <h2>用户{{id}}详情</h2>
        <el-card v-if="user">
            <p>id:{{user.id}}</p>
            <p>姓名:{{user.name}}</p>
            <p>性别:{{user.gender}}</p>
        </el-card>
    </div>
</template>